// 部门相关接口

import axios from '@/utils/request'
// 获取所有部门
export function getDepartments() {
  return axios({
    method: 'GET',
    url: '/company/department'
  })
}

/**
 * 删除部门
 * @param {string} id
 */
export function delDepartment(id) {
  return axios({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

/**
 * 添加部门
 * @param {*} data
 */
export function addDepartment(data) {
  return axios({
    method: 'POST',
    url: '/company/department',
    data
  })
}

/**
 * 根据ID查询部门详情
 * 点击查看详情发送的请求
 * @param {*} id
 */
export function getDepartDetail(id) {
  return axios({
    method: 'GET',
    url: `/company/department/${id}`
  })
}

/**
 * 点击确定编辑部门
 * @param {*} id
 */
export function updateDepartment(data) {
  return axios({
    method: 'PUT',
    url: '/company/department/' + data.id,
    data
  })
}
